<template>
    <!-- 红冲记录 -->
    <div>
        <h3> 红冲记录（共{{total}}条）</h3>
        <p class="fr">
          <span class="mr10">回款金额（元）:<span class="text-primary">￥{{form.yetReturnMoney}}</span></span>
          <span class="mr10">回款红冲（元）:<span class="text-primary">￥{{obj.balanceAmount}}</span></span>
          <span class="mr10">有效回款金额（元）:<span class="text-primary">￥{{form.validReturnedMoney}}</span></span>
        </p>
        <zm-table-data
        :data="tableParams.data"
        :columns="redDashedRecordColumns"
        :fetch="loadList"
        :table-params="tableParams"
        :mutilple="false"
      ></zm-table-data>
    </div>
</template>

<script>
import tableMixin from '@/mixins/zmTableMixin'
import {redDashedRecordColumns} from './const.js'
import { getPageList, getSalePriceData } from '@/api/src/returnedMoney'
export default {
  mixins: [tableMixin],
  props: {
    obj: {
      type: Object,
      required: true
    }
  },
  data () {
    return {
      total: '',
      form: {} // 回款详情红冲金额获取
    }
  },
  computed: {
    redDashedRecordColumns () {
      return redDashedRecordColumns(this)
    }
  },
  created () {
    this.init()
  },
  methods: {
    async loadList () {
      const _res = await getPageList(this.assignQuery({returnedNo: this.obj.returnedNo}))
      this.initialTableData(_res.list, _res.count)
      this.total = _res.count
    },
    init () {
      this.getSalePriceDataInfo()
    },
    async getSalePriceDataInfo () {
      const _res = await getSalePriceData({orderNo: this.obj.returnedNo})
      this.form = _res
    }
  }
}
</script>

<style>

</style>
